﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using ShivamEMR.Data.Repository.UserRepo;
using ShivamEMR.Model;
using ShivamEMR.Web.Models;
using ShivamEMR.Model.Domain.UIDomain;

namespace ShivamEMR.Web.Controllers
{
   //[Authorize]
    public class UserDashboardController : Controller
    {
        //
        // GET: /UserDashboard/

        //the action method authorization will be as below

       [CustomAuthorizeAttribute(RequiredRight="DashboardIndex")]
        public ActionResult Index()
        {         
            //var user = Registry.RepositoryFactory.GetUserRepository().All.SingleOrDefault(u => u.Name == User.Identity.Name);
            //List<MenuGroup> MenuGroups = new List<MenuGroup>();
            //if (user != null && user.Role != null && user.Role.DashboardMenu != null && user.Role.DashboardMenu.Children != null)
            //    foreach (var mg in user.Role.DashboardMenu.Children)
            //    MenuGroups.Add(mg); 
            //ViewBag.MenuGroups = MenuGroups;
            return View();
        }       

    }
}
